import {Injectable} from '@angular/core';
import {HttpClient} from '@angular/common/http';
import {Observable, of} from 'rxjs';
import {map} from 'rxjs/operators';

@Injectable({
  providedIn: 'root'
})
export class DeviceInfoService {


  constructor(private http: HttpClient) {
  }

  public getDeviceList(): Observable<Array<any>> {
    return this.http.post('getPageData', {
      entityName: 'DmzDevice',
      viewSize: 100000,
      viewIndex: 0,
      noConditionFind: 'Y',
      hasTimestamp: 'N',
      condition: {}
    }).pipe(map(({list}: any) => list.map(item => item.device)));

// return of(['xp-1029', 'win7-1909', 'win10-23334']);
  }

}
